import 'package:o_amap/aMapModule/common/latlng.dart';

class CalculateResult {
  List<Result> result;

  CalculateResult({this.result});

  CalculateResult.fromJson(Map<String, dynamic> json) {
    if (json['result'] != null) {
      result = new List<Result>();
      json['result'].forEach((v) {
        result.add(new Result.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.result != null) {
      data['result'] = this.result.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class Result {
  int allLength;
  int allTime;
  String labels;
  String pathId;
  int cost;
  List<LatLng> coordList;
  LatLng startPoint;
  LatLng endPoint;

  Result(
      {this.allLength,
      this.allTime,
      this.labels,
      this.pathId,
      this.cost,
      this.coordList,
      this.startPoint,
      this.endPoint});

  Result.fromJson(Map<String, dynamic> json) {
    allLength = json['allLength'];
    allTime = json['allTime'];
    labels = json['labels'];
    pathId = json['pathId'];
    cost = json['cost'];
    startPoint = json['startPoint'] != null
        ? new LatLng.fromJson(json['startPoint'])
        : null;
    endPoint =
        json['endPoint'] != null ? new LatLng.fromJson(json['endPoint']) : null;
    if (json['coordList'] != null) {
      coordList = new List<LatLng>();
      json['coordList'].forEach((v) {
        coordList.add(new LatLng.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['allLength'] = this.allLength;
    data['allTime'] = this.allTime;
    data['labels'] = this.labels;
    data['pathId'] = this.pathId;
    data['cost'] = this.cost;
    if (this.coordList != null) {
      data['coordList'] = this.coordList.map((v) => v.toJson()).toList();
    }
    if (this.startPoint != null) {
      data['startPoint'] = this.startPoint.toJson();
    }
    if (this.endPoint != null) {
      data['endPoint'] = this.endPoint.toJson();
    }
    return data;
  }
}
